CSS/HTML

推荐列表 站点导航

当前位置:首页 > 脚本编程 > CSS/HTML >

html中如何实现文本与标签居中

来源:网络整理  作者:  发布时间:2020-12-17 14:18
文本居中:【text-align: center;​line-height: 100px; (=height)】;标签居中:【margin: 0 auto;】。...
text-align: center; line-height: 100px; (=height)

2、标签居中

(推荐教程:html教程

margin: 0 auto; 其中0指的是margin-top:0

具体代码:

1、文本居中:

实现方法:

html中如何实现文本与标签居中

<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>搜索论坛</title> <link rel="stylesheet" href=https://www.ym97.com/"https:/www.baidu.com/img/baidu_jgylogo3.gif"> <style> .item1{ height: 100px; width: 100px; background-color: red; text-align: center; line-height: 100px; margin: 0 auto; } .item2{ height: 100px; width: 100px; background-color: wheat; text-align: center; line-height: 100px; margin: 100px auto; } </style> </head> <body> <div> <div>1111</div> <div>2222</div> </div> </body> </html>

以上就是html中如何实现文本与标签居中的详细内容,更多请关注聚合云库其它相关文章!

相关热词: HTML 标签

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://v30.fanwenzhu.com/jiaob/cssm/4846.shtml

Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

html中如何实现文本与标签居中

2020-12-17 编辑:

text-align: center; line-height: 100px; (=height)

2、标签居中

(推荐教程:html教程

margin: 0 auto; 其中0指的是margin-top:0

具体代码:

1、文本居中:

实现方法:

html中如何实现文本与标签居中

<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>搜索论坛</title> <link rel="stylesheet" href=https://www.ym97.com/"https:/www.baidu.com/img/baidu_jgylogo3.gif"> <style> .item1{ height: 100px; width: 100px; background-color: red; text-align: center; line-height: 100px; margin: 0 auto; } .item2{ height: 100px; width: 100px; background-color: wheat; text-align: center; line-height: 100px; margin: 100px auto; } </style> </head> <body> <div> <div>1111</div> <div>2222</div> </div> </body> </html>

以上就是html中如何实现文本与标签居中的详细内容,更多请关注聚合云库其它相关文章!

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://v30.fanwenzhu.com/jiaob/cssm/4846.shtml

相关文章

风云图片

推荐阅读

返回CSS/HTML频道首页